package com.baizhi.mall.config;

import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class OssConfig {
    @Bean
    public OSS getOssCliect() {
        // Endpoint以北京为例，其它Region请按实际情况填写。
        String endpoint = "https://oss-cn-beijing.aliyuncs.com";
        // 阿里云主账号AccessKey拥有所有API的访问权限，风险很高。强烈建议您创建并使用RAM账号进行API访问或日常运维，请登录RAM控制台创建RAM账号。
        String accessKeyId = "LTAI5t9TEQFxos6xFobfwkdC";
        String accessKeySecret = "mhty40dwqBy7GH4WHV5k6jePXUYuoU";

        OSS client = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
        return client;
    }
}